//
//  BaseNavVC.swift
//  FastDevelop
//
//  Created by IOS1 on 2025/6/26.
//

import UIKit

class BaseNavVC: UINavigationController {

    // MARK: - override
    override func viewDidLoad() {
        super.viewDidLoad()
        
        _setupPopGesture()
    }
    
    override func pushViewController(_ viewController: UIViewController, animated: Bool) {
        if (self.viewControllers.count > 0) {
            viewController.hidesBottomBarWhenPushed = true
        }
        super.pushViewController(viewController, animated: animated)
    }
    
    // MARK: - setup
    private func _setupPopGesture() {
        interactivePopGestureRecognizer?.isEnabled = true
        interactivePopGestureRecognizer?.delegate = self
    }

}

// MARK: - UIGestureRecognizerDelegate
extension BaseNavVC: UIGestureRecognizerDelegate {
    func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
        viewControllers.count > 1
    }
}
